<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
    <h1>微博首页</h1>
    <div v-if="user.nickname==null">
        <a href="/reg.html">注册</a>
        <a href="/login.html">登录</a>
    </div>
    <div v-else>
        <h1>欢迎{{user.nickname}}回来</h1>
        <a href="javascript:void (0)" @click="rome()">退出登录</a>
        <a href="/send.html">上传微博</a>
    </div>
    <div v-for="weibo in arr">
        <h1><a :href="'/detail.html?id='+weibo.id">{{weibo.nickname}}说:{{weibo.content}}</a></h1>
    </div>
</div>
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>
   <script src=" https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script>
     <script>
       let v=new Vue({
         el:"body>div",
         data:{
             user:"",
             arr:[],
         },
         methods:{
             rome(){
                 axios.get("/romeUser").then(function (r) {
                     v.user={};
                 })
             }
         },
           created:function (){
             axios.get("/selectUser").then(function (r) {
                 v.user=r.data;
             }),
                 axios.get("/weibo/selects").then(function (r) {
                     v.arr=r.data;
                 })
           }
       })

     </script>
</body>
</html>